﻿using System.IO.Ports;

namespace GKQC.Machine
{
    public interface ILcrMeter
    {
        bool Check(SerialPort sp);

        /// <summary>
        /// 解析数据
        /// 19001A:-1.81063E-07,-1.08717E+01,-9.55242E+04,+9.59595E+04,0
        /// 11022:+0,+6.36921E-06,+1.34525E+00
        /// </summary>
        /// <param name="str"></param>
        /// <param name="cap">测试值1</param>
        /// <param name="df">测试值2</param>
        /// <param name="testItem">测试模式</param>
        /// <returns></returns>
        bool AnalysisData(string str, out decimal cap, out decimal df, out decimal z, out decimal r
            , string testItem,string zrFreq ,bool isRaw);
        /// <summary>
        /// 测试指令：由两部分组成：
        /// 1 设置测试模式的指令，如 C/D  Z/R等
        /// 2 读取数据的指令
        /// </summary>
        /// <param name="sp">串口</param>
        /// <param name="testItem">测试模式</param>
        void Fetch(SerialPort sp, string testItem);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sp"></param>
        /// <returns></returns>
        string GetData(SerialPort sp);
        /// <summary>
        /// 设置频率
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="freq">频率</param>
        void SetFreq(SerialPort sp, string freq, string freq2,string testItem);

        /// <summary>
        /// 開路校正
        /// </summary>
        void Open(SerialPort sp);
        /// <summary>
        /// 短路
        /// </summary>
        void Short(SerialPort sp);

        /// <summary>
        /// 控制機器
        /// </summary>
        void Remote(SerialPort sp);
        /// <summary>
        /// 取消控制機器
        /// </summary>
        void Local(SerialPort sp);
    }
}